<template>
	<view>
		<view class="cy_list" v-for="(item,index) in list" :key="'ii2-'+index">
			<view class="cy_li">
			     <text class="cy_li_tit t23">{{(item.adInc)/100}}元</text>
			     
			     <text class="cy_li_tit t5 tri" v-if="item.status==0">未发放</text>
			     <text class="cy_li_tit t7 tri" v-if="item.status==1">发放中</text>
			     <text class="cy_li_tit t24 tri" v-if="item.status==2">已发放</text>
			     <text class="cy_li_tit t5" style="width: 100%;">广告收益：{{item.adInc/100}}元（第二天计算收益）</text>
			     <text class="cy_li_tit t24">{{item.createdTime}}</text>
			</view>
		</view>
		<view class="zanwu" v-show="jiazai" style="padding: 4vw 0;"><text class="t7">{{more}}</text></view>
		<view class="zanwu" v-show="zanwu" style="padding: 4vw 0;">
			<image src="../../static/img/kong.png" mode="widthFix" style="margin-left: 35vw;"></image><text
				class="t8">{{wu}}</text>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			const currentDate = this.getDate({
				format: true
			})
			return {
				Inv: 0,
				date: currentDate,
				mainid: '',
				list: [],
				pages: 1,
				ismore: true,
				more: '加载更多',
				jiazai: false,
				wu: "暂无数据",
				zanwu: false,
			}
		},
		computed: {
			startDate() {
				return this.getDate('start');
			},
			endDate() {
				return this.getDate('end');
			}
		},
		onLoad() {
			// _self = this;
			var _this = this;
			uni.getStorage({
				key: 'user',
				success: function(res) {
					_this.mainid = res.data.id;
					_this.mingxi();
				}
			});
		},

		// 监听触底
		onReachBottom() {
			//阻止重复加载
			if (this.ismore == false) {
				return;
			}
			this.pages++;
			this.mingxi();
		},
		methods: {
			myTeam(type) {
				var _that = this;
				_that.Inv = type;
				_that.pages = 1;
			_that.mingxi();
			},
			getDate(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();

				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 2;
				}
				month = month > 9 ? month : '0' + month;;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},
			bindDateChange: function(e) {
				this.date = e.detail.value
			},
			// scroll(e) {
			// 	this.old.scrollTop = e.detail.scrollTop
			// 	console.log(e.detail.scrollTop);
			// },
			//记录滚动条位置
			goTop() {
				uni.pageScrollTo({
					scrollTop: 0 //距离页面顶部的距离
					// duration: 300
				});
			},


			xq(id) {
				uni.navigateTo({
					url: '/pages/mingxi/mingxi_jiaoyi_log?id=' + id
				});
			},
			changeTab(Inv) {
				that.navIdx = Inv;

			},
			mingxi() {
				uni.request({
					header: {
						'Content-Type': 'application/json', //自定义请求头信息
					},
					url: getApp().globalData.url + 'agent/getMchAdincEveryDay/' + this.mainid, //仅为示例，并非真实接口地址。
					method: 'POST',
					data: {
						id: this.mainid //	用户ID（mainId）		true	string
					},
					success: (res) => {
						uni.hideLoading(); //关闭加载动画
						console.log(res);
						if (res.data.status == '200') {
							this.list = res.data.data;
						}
					},
					fail: (error) => {
						uni.hideLoading();
						// this.checks = true
						uni.showToast({
							title: error,
							icon: 'none',
							duration: 2000
						});
						console.log(error)
					}
				});
			},
		}
	}
</script>

<style>
	.inv-h-w {
		background-color: #FFFFFF;
		height: 10vw;
		display: flex;
		width: 100%;
		position: fixed;
		top: 0;
		left: 0;z-index: 99;
	}

	.inv-h {
		font-size: 0.8rem;
		flex: 1;
		text-align: center;
		color: #333;
		height: 10vw;
		line-height: 10vw;
	}

	.inv-h-se {
		color: #F1C75E;
		border-bottom: 1vw solid #F1C75E;
	}



	.loading {
		text-align: center;
		line-height: 10vw;
	}

	.cy_user {
		width: 90%;
		height: auto;
		display: block;
		float: left;
		margin: 2vw 5%;
		background: -webkit-linear-gradient(#8A3DE2, #9C4BF9);
		background: -o-linear-gradient(#8A3DE2, #9C4BF9);
		background: -moz-linear-gradient(#8A3DE2, #9C4BF9);
		background: linear-gradient(#8A3DE2, #9C4BF9);
		border-radius: 1vw;
		padding: 4vw;
		box-shadow:0px 0px 5px #F2F2F2;
	}

	.cy_user_tit {
		width: 100%;
		height: 18vw;
		line-height: 8vw;
		display: block;
		float: left;
		text-align: left;
		margin-bottom: 2vw;
		border-bottom: 1px solid #fff;
		text-align: center;
		padding-bottom: 2vw;
	}

	.cy_user_into {
		width: 33.33%;
		height: auto;
		display: block;
		float: left;
		line-height: 7vw;
		display: block;
		float: left;
		margin: 2vw 0;
		text-align: center;
	}

	.cy_user_input {
		width: 20vw;
		height: 7vw;
		display: block;
		float: right;
		background: url(../../static/img/but.png)no-repeat top center;
		background-size: 100%;
		text-align: center;
		line-height: 7vw;
		margin: 1vw 0;
	}

	.cy_user_into text {
		margin-right: 2vw;
	}

	.cy_list {
		width: 90%;
		height: auto;
		display: block;
		float: left;
		margin: 0 5%;
		margin-bottom: 2vw;
		box-shadow:0px 0px 5px #F2F2F2;
		border-radius: 1vw;
		padding: 4vw;
		background: #fff;
		margin-top: 1vw;
	}

	.cy_li {
		width: 100%;
		height: auto;
		display: block;
		float: left;
		/* margin-bottom: 4vw; */
		border-bottom: 1px solid #F2F2F2;
		/* padding-bottom: 4vw; */
	}

	.cy_li:last-child {
		border: none;
	}

	.cy_li .cy_img{
		width: 16vw;
		height: 16vw;
		display: block;
		float: left;
		margin: 2vw 0;
		border-radius:2vw;
		overflow: hidden;
		border: 1px solid #F8F8F8;
		margin-right: 2vw;
	}
	.cy_li .cy_img image{
		width: 16vw;
		height: auto;
		display: block;
		float: left;
	}

	.cy_li_tit {
		width: 50%;
		height: auto;
		line-height: 9vw;
		display: block;
		float: left;
	}

	.cy_li_tit1 {
		width: 100%;
		height: auto;
		line-height: 9vw;
		display: block;
		float: left;
	}


	.cy_li_info {
		width: 100%;
		height: 7vw;
		line-height: 7vw;
		display: block;
		float: left;
		padding: 0 3vw;
	}

	.tri {
		text-align: right;
	}

	.cy_list_tit {
		width: 100%;
		height: 12vw;
		line-height: 12vw;
		display: block;
		float: left;
		text-align: center;
	}

	.cen {
		text-align: center;
		width: 44%;
	}

	.tabshow {
		width: 100%;
		height: auto;
		display: block;
		float: left;
		background: #fff;
		position: fixed;
		top: 10vw;
		left: 0;
		padding: 3vw 5vw;
	}

	.tabshow_li {
		width: 100%;
		height: auto;
		display: block;
		float: left;
	}

	.show_tit {
		width: 30%;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: left;
	}

	.show_ri {
		width: 70%;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: left;
		text-align: right;
	}

	.bai {
		width: 100%;
		height: 14vw;
		display: block;
		float: left;
	}

	.cy_li image.cy_li_ri_img {
		width: 2vw;
		float: right;
		margin-top: 8vw;
	}

	.cy_li_le {
		width: 90%;
		float: left;
	}

	.cy_li_ri {
		width: 10%;
		float: right;
	}

	.zanwu {
		margin-bottom: 10vw;
	}
	.cy_main{width: 75%;height: auto;float: left;margin-top: 1vw;}
</style>
